<?php
	include_once dirname(dirname(__FILE__)).'/inc/bootConfig.php';

	$username = getRequest('user');
	$userpwd = getRequest('pwd');
	$chknumber = getRequest('chknumber');
	
	if(empty($username) || empty($userpwd) || empty($chknumber)){
		jstop('用户名、密码、验证码不能为空');
	}
	
	if($chknumber != $_SESSION['check_code']){
		jstop("请输入正确的验证码");
	}
	
	if(User_Check::checkUserName($username)){
		if(User_Check::checkUserPwd($username,$userpwd)){
			$_SESSION['username'] = $username;
			setcookie('username',$username,time()+15*60,'/');
			setcookie('userOnLineTime',1,time()+6,'/');
			User_User::updateAdminLoginState($username);
			header("Location:main.php");
		}else{
			jstop('您输入的用户名或密码错误1');
		}
	}else{
		jstop('您输入的用户名或密码错误');
	}
	
	